package com.yiren.dbaa.module.param_config.api;

import android.content.Context;
import android.util.Log;

import com.yiren.backstage.config.api.SaveConfigApi;
import com.yiren.backstage.config.bean.device.CarSignalConfigBean;
import com.yiren.backstage.config.bean.device.DeviceStudyConfigBean;
import com.yiren.backstage.config.bean.device.PracticeCarCheckConfigBean;
import com.yiren.backstage.config.bean.device.SignalSourceConfigBean;
import com.yiren.backstage.config.bean.device.StationParamConfigBean;
import com.yiren.backstage.config.bean.device.UserParamConfigBean;
import com.yiren.backstage.config.bean.device.UserRiskConfigBean;
import com.yiren.backstage.config.enums.ConfigNameEnum;
import com.yiren.dbaa.module.param_config.services.IParamConfigService;
import com.yiren.dbaa.module.param_config.services.impl.ParamConfigServiceImpl;

/**
 * Created by WANGRONGXIANG
 * on 2022/5/25
 * Describe 保存参数配置服务类
 */
public class ParamConfigApi {

    public static final String TAG = "ParamConfigApi";

    private static IParamConfigService iParamConfig = new ParamConfigServiceImpl();

    /**
     * 保存车辆信号配置(正反转) 对象
     */
    public static void saveCarSignalConfig(Context context, CarSignalConfigBean carSignalConfigBean) {
        Log.i(TAG, "saveCarSignalConfig");
        iParamConfig.uploadParamConfig(context, ConfigNameEnum.CAR_SIGNAL_CONFIG.toString(), 1, carSignalConfigBean);
    }

    /**
     * 保存设备学习数据配置参数
     */
    public static void saveDeviceStudyConfig(Context context, DeviceStudyConfigBean deviceStudyConfigBean) {
        Log.i(TAG, "saveDeviceStudyConfig");
        iParamConfig.uploadParamConfig(context, ConfigNameEnum.DEVICE_STUDY_CONFIG.toString(), 1, deviceStudyConfigBean);
    }

    /**
     * 保存练车检测参数配置
     */
    public static void savePracticeCarCheckConfig(Context context, PracticeCarCheckConfigBean practiceCarCheckConfigBean) {
        Log.i(TAG, "savePracticeCarCheckConfig");
        iParamConfig.uploadParamConfig(context, ConfigNameEnum.PRACTICE_CAR_CHECK_CONFIG.toString(), 1, practiceCarCheckConfigBean);
    }

    /**
     * 保存信号源配置参数
     */
    public static void saveSignalSourceConfig(Context context, SignalSourceConfigBean signalSourceConfigBean) {
        Log.i(TAG, "saveSignalSourceConfig");
        iParamConfig.uploadParamConfig(context, ConfigNameEnum.SIGNAL_SOURCE_CONFIG.toString(), 1, signalSourceConfigBean);
    }

    /**
     * 保存固定站移动站主机盒参数配置
     */
    public static void saveStationParamConfig(Context context, StationParamConfigBean stationParamConfigBean) {
        Log.i(TAG, "saveStationParamConfig");
        iParamConfig.uploadParamConfig(context, ConfigNameEnum.STATION_PARAM_CONFIG.toString(), 1, stationParamConfigBean);
    }

    /**
     * 保存用户参数配置
     */
    public static void saveUserParamConfig(Context context, UserParamConfigBean userParamConfigBean) {
        Log.i(TAG, "saveUserParamConfig");
        //用户参数不需要上传服务器
        SaveConfigApi.saveUserParamConfig(context, userParamConfigBean);
//        iParamConfig.uploadParamConfig(context, ConfigNameEnum.USER_PARAM_CONFIG.toString(), 1, userParamConfigBean);
    }

    /**
     * 保存用户风控参数配置
     */
    public static void saveUserRiskConfig(Context context, UserRiskConfigBean userRiskConfigBean) {
        Log.i(TAG, "saveUserRiskConfig");
        //用户风控参数不需要上传服务器
        SaveConfigApi.saveUserRiskConfig(context, userRiskConfigBean);
//        iParamConfig.uploadParamConfig(context, ConfigNameEnum.USER_PARAM_CONFIG.toString(), 1, userRiskConfigBean);
    }

}